package com.pizza.abstrait;

import java.io.Serializable;

import javax.faces.context.FacesContext;

import com.pizza.control.ClientBean;
import com.pizza.control.CommandeBean;

/**
 * 
 * Class AbstractArticle, classe abstraite rassemblant toutes les informations d'un article.
 *
 */
public abstract class AbstractArticle implements Serializable
{
	private int id;

	private String nom;

	private float prix;

	private String description;
	
	private String url_image;

	private String type;
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getDescription()
	{
		return description;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public String getNom()
	{
		return nom;
	}

	public void setNom(String nom)
	{
		this.nom = nom;
	}

	public float getPrix()
	{
		return prix;
	}

	public void setPrix(float prix)
	{
		this.prix = prix;
	}

	public String getUrl_image() {
		return url_image;
	}

	public void setUrl_image(String url_image) {
		this.url_image = url_image;
	}
	
	public void ajouterArticleCommande() {
		FacesContext context = FacesContext.getCurrentInstance();
		CommandeBean commande = (CommandeBean) context.getExternalContext()
		.getSessionMap().get("commandeBean");
		
		if(commande != null) {
			commande.ajouterArticlePanier(this);
		}
	}
}
